﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: Tuesday, July 12, 2011 11:08:17 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using DatabaseGeneric;
using DatabaseGeneric.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace DatabaseGeneric.FactoryClasses
{
	/// <summary>Generates IEntityFields2 instances for different kind of Entities.</summary>
	public partial class EntityFieldsFactory
	{
		/// <summary>Private CTor, no instantiation possible.</summary>
		private EntityFieldsFactory()
		{
		}

		/// <summary>General factory entrance method which will return an EntityFields object with the format generated by the factory specified</summary>
		/// <param name="relatedEntityType">The type of entity the fields are for</param>
		/// <returns>The IEntityFields2 instance requested</returns>
		public static IEntityFields2 CreateEntityFieldsObject(DatabaseGeneric.EntityType relatedEntityType)
		{
			IEntityFields2 fieldsToReturn=null;
			IInheritanceInfoProvider inheritanceProvider = InheritanceInfoProviderSingleton.GetInstance();
			IFieldInfoProvider fieldProvider = FieldInfoProviderSingleton.GetInstance();
			switch(relatedEntityType)
			{
				case DatabaseGeneric.EntityType.ChungLoaiSanPhamEntity:
					fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "ChungLoaiSanPhamEntity");
					break;
				case DatabaseGeneric.EntityType.LoginLogoutEntity:
					fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "LoginLogoutEntity");
					break;
				case DatabaseGeneric.EntityType.SanPhamEntity:
					fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "SanPhamEntity");
					break;
				case DatabaseGeneric.EntityType.SanPhamKhuonEntity:
					fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "SanPhamKhuonEntity");
					break;
                case DatabaseGeneric.EntityType.SanPhamClastEntity:
                    fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "SanPhamClastEntity");
                    break;
                case DatabaseGeneric.EntityType.SanPhamGotCheEntity:
                    fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "SanPhamGotCheEntity");
                    break;
                case DatabaseGeneric.EntityType.SanPhamBoEntity:
                    fieldsToReturn = fieldProvider.GetEntityFields(inheritanceProvider, "SanPhamBoEntity");
                    break;
			}
			return fieldsToReturn;
		}
		
		/// <summary>General method which will return an array of IEntityFieldCore objects, used by the InheritanceInfoProvider. Only the fields defined in the entity are returned, no inherited fields.</summary>
		/// <param name="entityName">the name of the entity to get the fields for. Example: "CustomerEntity"</param>
		/// <returns>array of IEntityFieldCore fields, defined in the entity with the name specified</returns>
		internal static IEntityFieldCore[] CreateFields(string entityName)
		{
			IFieldInfoProvider fieldProvider = FieldInfoProviderSingleton.GetInstance();
			return fieldProvider.GetEntityFieldsArray(entityName);
		}
		



		#region Included Code

		#endregion
	}
}
